package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Setmeal;
import com.itheima.reggie.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

public interface SetmealDishMapper {

    Integer save(@Param("setmealDishList") List<SetmealDish> setmealDishList);


    //删除指定的多个套餐id的套餐菜品关系数据(伪删除)
    Integer deleteBySetmealIds(@Param("ids") List<Long> ids,
                               @Param("updateUser") Long updateUser,
                               @Param("updateTime") LocalDateTime updateTime
                               );

    @Select("select * from setmeal where category_id=#{categoryId} and status=#{status}")
    List<Setmeal> list(@Param("categoryId") Long categoryId, @Param("status") Integer status);

    @Delete("delete from setmeal_dish where setmeal_id=#{id}")
    Integer delete(Long id);

    Integer insert(@Param("setmealDishList") List<SetmealDish> setmealDishList);
}
